import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QuestionaireAnswerVO, QuestionaireAnswerForm, QuestionaireAnswerQuery } from '@/api/stroke/questionaireAnswer/types';

/**
 * 查询问卷用户答案列表
 * @param query
 * @returns {*}
 */

export const listQuestionaireAnswer = (query?: QuestionaireAnswerQuery): AxiosPromise<QuestionaireAnswerVO[]> => {
  return request({
    url: '/stroke/questionaireAnswer/list',
    method: 'get',
    params: query
  });
};

/**
 * 翻译 查询问卷用户答案列表
 * @param query
 * @returns {*}
 */
export const listTransQuestionaireAnswer = (query?: QuestionaireAnswerQuery): AxiosPromise<QuestionaireAnswerVO[]> => {
  return request({
    url: '/stroke/questionaireAnswer/list',
    method: 'get',
    params: query
  });
};


/**
 * 查询问卷用户答案详细
 * @param id
 */
export const getQuestionaireAnswer = (id: string | number): AxiosPromise<QuestionaireAnswerVO> => {
  return request({
    url: '/stroke/questionaireAnswer/' + id,
    method: 'get'
  });
};

/**
 * 新增问卷用户答案
 * @param data
 */
export const addQuestionaireAnswer = (data: QuestionaireAnswerForm) => {
  return request({
    url: '/stroke/questionaireAnswer',
    method: 'post',
    data: data
  });
};

/**
 * 修改问卷用户答案
 * @param data
 */
export const updateQuestionaireAnswer = (data: QuestionaireAnswerForm) => {
  return request({
    url: '/stroke/questionaireAnswer',
    method: 'put',
    data: data
  });
};

/**
 * 删除问卷用户答案
 * @param id
 */
export const delQuestionaireAnswer = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/questionaireAnswer/' + id,
    method: 'delete'
  });
};
